home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / BMSRC.ZIP / 68040.S next >
Encoding:
Text File  |  1996-11-25  |  3.6 KB  |  152 lines

  1. *-------------------------------------------------------*
  2.             text
  3. *-------------------------------------------------------*
  4.  
  5. page_size        =    8192
  6.  
  7. *-------------------------------------------------------*
  8. initialise_pmmu:
  9. *-------------------------------------------------------*
  10.     move.l        #-1,bss_handle
  11.     move.l        #-1,display_handle
  12.     ifd        use_xmmu
  13.     move.l        #'XMMU',d0
  14.     bsr        cookie_search
  15.     tst.l        d0
  16.     bmi.s        .npmu
  17.     move.l        4(a0),a0
  18.     move.l        pmmu_read(a0),pmmu_read_rout
  19.     move.l        pmmu_write(a0),pmmu_write_rout
  20.     move.l        pmmu_cmc(a0),pmmu_cbc_rout
  21.     move.l        pmmu_cmn(a0),pmmu_noc_rout
  22.     bsr        mark_bss
  23.     bsr        mark_display
  24.     endc
  25. .npmu:    rts
  26.  
  27. *-------------------------------------------------------*
  28. mark_bss:
  29. *-------------------------------------------------------*
  30. *    Allocate space for BSS pages            *
  31. *-------------------------------------------------------*
  32.     lea        bss_start,a0
  33.     lea        bss_all_end,a1
  34.     moveq        #13,d2
  35.     move.l        a0,d0
  36.     move.l        a1,d1
  37.     add.l        #page_size-1,d1
  38.     lsr.l        d2,d0
  39.     lsr.l        d2,d1
  40.     sub.l        d0,d1
  41.     lsl.l        #2,d1
  42.     move.l        d1,d0
  43.     movem.l        a0-a1,-(sp)
  44.     moveq        #VRAM_preferred,d1
  45.     bsr        allocate_chunk
  46.     movem.l        (sp)+,a0-a1
  47.     tst.l        d0
  48.     ble.s        .nbss
  49.     move.l        d0,bss_handle
  50.     move.l        d0,a2
  51.     movem.l        a0-a2,-(sp)
  52.     jsr        ([pmmu_read_rout.l])
  53.     movem.l        (sp)+,a0-a2
  54.     jsr        ([pmmu_cbc_rout.l])
  55. .nbss:    rts
  56.  
  57. *-------------------------------------------------------*
  58. mark_display:
  59. *-------------------------------------------------------*
  60. *    Allocate space for display pages        *
  61. *-------------------------------------------------------*
  62.     move.l        display_start,a0
  63.     move.l        display_size,d0
  64.     lea        (a0,d0.l),a1
  65.     moveq        #13,d2
  66.     move.l        a0,d0
  67.     move.l        a1,d1
  68.     add.l        #page_size-1,d1
  69.     lsr.l        d2,d0
  70.     lsr.l        d2,d1
  71.     sub.l        d0,d1
  72.     lsl.l        #2,d1
  73.     move.l        d1,d0
  74.     movem.l        a0-a1,-(sp)
  75.     moveq        #VRAM_preferred,d1
  76.     bsr        allocate_chunk
  77.     movem.l        (sp)+,a0-a1
  78.     tst.l        d0
  79.     ble.s        .ndsp
  80.     move.l        d0,display_handle
  81.     move.l        d0,a2
  82.     movem.l        a0-a2,-(sp)
  83.     jsr        ([pmmu_read_rout.l])
  84.     movem.l        (sp)+,a0-a2
  85.     jsr        ([pmmu_noc_rout.l])
  86. .ndsp:    rts
  87.  
  88. *-------------------------------------------------------*
  89. restore_pmmu:
  90. *-------------------------------------------------------*
  91.     bsr        unmark_bss
  92.     bsr        unmark_display
  93.     rts
  94.  
  95. *-------------------------------------------------------*
  96. unmark_bss:
  97. *-------------------------------------------------------*
  98.     move.l        bss_handle,d0
  99.     ble.s        .err
  100.     move.l        d0,a2
  101.     lea        bss_start,a0
  102.     lea        bss_all_end,a1
  103.     jsr        ([pmmu_write_rout.l])
  104.     move.l        bss_handle,d0
  105.     bsr        deallocate_chunk
  106. .err    rts
  107.  
  108. *-------------------------------------------------------*
  109. unmark_display:
  110. *-------------------------------------------------------*
  111.     move.l        display_handle,d0
  112.     ble.s        .err
  113.     move.l        d0,a2
  114.     move.l        display_start,a0
  115.     move.l        display_size,d0
  116.     lea        (a0,d0.l),a1
  117.     jsr        ([pmmu_write_rout.l])
  118.     move.l        display_handle,d0
  119.     bsr        deallocate_chunk
  120. .err    rts
  121.  
  122. *---------------------------------------------------------------*
  123. cookie_search:
  124. *---------------------------------------------------------------*
  125.     move.l        cookie_jar.w,a0
  126. .loop:    cmp.l        (a0),d0
  127.     beq.s        .find
  128.     tst.l        (a0)
  129.     beq.s        .fail
  130.     addq.l        #8,a0
  131.     bra.s        .loop
  132. .find:    moveq        #0,d0
  133.     bra.s        .end
  134. .fail:    moveq        #-1,d0
  135. .end:    rts
  136.  
  137. *-------------------------------------------------------*
  138.             bss
  139. *-------------------------------------------------------*
  140.             
  141. pmmu_resident:        ds.l    1
  142. pmmu_read_rout:        ds.l    1
  143. pmmu_write_rout:    ds.l    1
  144. pmmu_cbc_rout:        ds.l    1
  145. pmmu_noc_rout:        ds.l    1
  146. bss_handle:        ds.l    1
  147. display_handle:        ds.l    1
  148.  
  149. *-------------------------------------------------------*
  150.             text
  151. *-------------------------------------------------------*
  152.